#ifndef TEXTRENDER_HPP
#define TEXTRENDER_HPP

#include <Eigen/Geometry>

#include <GL/glew.h>

#include <QStringList>
#include <QFont>
#include <QGLWidget>

namespace rtrt
{
  
  //! Class for rendering text in OpenGL widgets
  class TextRender : QObject
  {
  Q_OBJECT
  public:
    
    //! Default constuctor
    TextRender();
    //! Constructor
    TextRender( const QString& fontFamily, //!< Family of using font
		int fontSize             , //!< Size of using font
		QColor textColor           //!< Color used for rendering text 
	      );
    
    //! Sets using font
    void setFont( const QString& textFamily, //!< Family of font
		  int textSize               //!< Size of font
		);
    
    //! Adds line of text
    void add( const QString& string //!< Text to add                       
            );
    
    //! Adds line of text
    /*! Will be represented as "name value"
     */
    void add( const QString& name,  //!< Name of value
	      GLfloat         value //!< Value
	    );
    //! Adds line of text
    /*! Will be represented as "name ( value.x(), value.y() )"
     */
    void add( const QString& name,  //!< Name of value
	      Eigen::Vector2f value //!< Value
	    );
    
    //! Adds line of text
    /*! Will be represented as "name ( value.x(), value.y(), value.z() )"
     */
    void add( const QString& name,  //!< Name of value
	      Eigen::Vector3f value //!< Value
	    );
    
    ////! Adds line of text
    ///*! Will be represented as "name ( value.x(), value.y(), value.z(), value.w() )"
    // */
    //void add( const QString& name,  //!< Name of value
	   //   Eigen::Vector4f value //!< Value
	   // );
 
    ////! Adds line of text
    //void add( const QString& name,//!< Name of value
	   //   Eigen::Quaternionf value //!< Value
	   // );
    
    //! Clears text data
    void clear();
    
    //! Draws text data in QGLWidget object
    void draw( QGLWidget *widget, //!< Widget used for rendering
	       int x,             //!< X position of text
	       int y              //!< Y position of text
	     );
    
    //! Color used for rendering text
    QColor color();
    
    //! Sets color for rendering text
    void setColor( QColor color );
    
  private:
    
    QFont       _font;
    QStringList _text;
    
    QColor _color;
    
  };
  
}

#endif